import auth from '@/utils/auth'
import router, { resetRouter, asyncRoutes, constantRoutes } from '@/router'
import qs from 'qs'
import axios from '@/utils/request'

const state = {
  routes: [],
  asyncRoutes: [],
  token: auth.getToken(),
  name: '',
  avatar: '',
  introduction: '',
  roles: [],
  permissionIds: [] //  权限id数组
}
const mutations = {
  SET_TOKEN: (state, token) => {
    state.token = token
  },
  SET_INTRODUCTION: (state, introduction) => {
    state.introduction = introduction
  },
  SET_NAME: (state, name) => {
    state.name = name
  },
  SET_AVATAR: (state, avatar) => {
    state.avatar = avatar
  },
  SET_ROLES: (state, roles) => {
    state.roles = roles
  },
  // SET_USERID: (state, userId) => {
  //   state.userId = userId
  // },
  //  将权限id数组存入store中
  SET_PERMISSIONIDS: (state, permissionIds) => {
    state.permissionIds = permissionIds
  }

}

const actions = {

}

export default {
  namespaced: true,
  state,
  mutations,
  actions
}
